﻿package org.openChart.display 
{
	import org.openChart.display.DisplayColorLabelGroup;
	import org.openChart.display.DisplayGroupSet;
	import org.openChart.display.DisplayScreen;
	import org.openChart.meta.PieChart;
	import org.openChart.meta.ChartType;
	import org.openChart.meta.TextLabel;
	import org.openChart.util.Rectangle;
	/**
	 * ...
	 * @author Chongyuan
	 */
	public class DisplayPieChart extends DisplayChart implements DisplayInterface
	{
		
		
		private var viewAngle_:Number;
		private var thickness_:Number;
		private var deviation_:Number;
		private var textlabels_:Array;
		private var colorLabelGroup_:DisplayColorLabelGroup;
		
		public static var TEXT_LABEL:String = "text-label";
		public static var COLOR_LABEL_LEFT:String = "color-label-left";
		public static var COLOR_LABEL_RIGHT:String = "color-label-right";
		public static var COLOR_LABEL_TOP:String = "color-label-top";
		public static var COLOR_LABEL_BOTTOM:String = "color-label-bottom";
		
		public function DisplayPieChart( pieChart:PieChart, sreen:DisplayScreen)
		{
			super(pieChart, sreen);
			
		}
		
		public override function initialize():void
		{
			var pieChart:PieChart = chart as PieChart;
			
			for (var i:uint = 0; i <  pieChart.labels.length; i++ )
			{
				var colorLabel:DisplayColorLabel = new DisplayColorLabel(null);
				var textLabel:TextLabel = pieChart.labels[i] as TextLabel;
				var displayLabel:DisplayTextLabel = new DisplayTextLabel(textLabel);
				colorLabel.label = displayLabel;
				parent.labels.addColorLabel(colorLabel);
			}
			
			
			this.viewAngle = chart.getStyle().viewAngle;
			this.deviation  = chart.getStyle().offset;
			if (chart.chartType == ChartType.PIE_CHART_3D)
				this.deviation = 0;
			this.thickness = chart.getStyle().thickness;
			super.initialize();
		}
		
		public override function resize(rectangle:Rectangle):void
		{
			super.resize(rectangle);
		}
		
		public function set textlabels( textlabels_:Array):void
		{
			this.textlabels_ = textlabels_;
		}
		
		public function get textlabels():Array
		{
			return this.textlabels_;
		}
		
		public function set viewAngle( viewAngle_:Number ):void
		{
			this.viewAngle_ = viewAngle_;
		}
		
		public function get viewAngle():Number
		{
			return this.viewAngle_;
		}
		
		public function set thickness( thickness_:Number):void
		{
			this.thickness_ = thickness_;
		}
		
		public function get thickness():Number
		{
			return this.thickness_;
		}
		
		public function set deviation( deviation_:Number ):void
		{
			this.deviation_ = deviation_;
		}
		
		public function get deviation():Number
		{
			return this.deviation_;
		}
		
		
	}
	
}